﻿@{
    ViewBag.Title = "AreaIndex";
    Layout = "~/Views/Shared/_LayoutIndex.cshtml";
}
<script>
    var SPRId = request('SPRId');
    var SPLId = request('SPLId');
    $(function () {
        InitialPage();
        GetGrid();
    });
    var _itemId = "";
    //初始化页面
    function InitialPage() {
        //layout布局
        $('#layout').layout({
            applyDemoStyles: true,
            onresize: function () {
                $(window).resize()
            }
        });
        //resize重设(表格、树形)宽高
        $(window).resize(function (e) {
            window.setTimeout(function () {
                $('#gridTable').setGridWidth(($('.gridPanel').width()));
                $("#gridTable").setGridHeight($(window).height() - 165.5);
            }, 200);
            e.stopPropagation();
        });
    }

    //加载表格
    function GetGrid() {
        var selectedRowIndex = 0;
        var $gridTable = $('#gridTable');
        $gridTable.jqGrid({
            url: "../../PropertyManage/SecurityPatrol/GetAreaList",
            postData: {
                SPLId: SPLId,
                SPRId: SPRId
            },
            datatype: "json",
            height: $(window).height() - 165.5,
            autowidth: true,
            colModel: [
                { label: "主键", name: "SPLDId", hidden: true },
                { label: "公共区域名称", name: "Name", index: "Name", width: 80, align: "center" },
                { label: "巡检方式", name: "FlagWay", index: "FlagWay", width: 80, align: "center" },
                { label: "巡检标识编码", name: "FlagNo", index: "FlagNo", width: 250, align: "center" },
                { label: "巡检状态", name: "Status", index: "Status", width: 80, align: "center" },
                { label: "巡检时间", name: "Date", index: "Date", width: 100, align: "center" },
                 { label: "巡检人", name: "InspectionManName", index: "InspectionManName", width: 80, align: "center" },
                 { label: "说明", name: "Memo", index: "Memo", width: 80, align: "center" }
            ],
            viewrecords: true,
            rowNum: 30,
            rowList: [30, 50, 100],
            pager: "#gridPager",
            sortname: 'CreateDate',
            sortorder: 'desc',
            rownumbers: true,
            shrinkToFit: false,
            gridview: true,
            onSelectRow: function (status) {
                selectedRowIndex = $("#" + this.id).getGridParam('selrow');
            },
            gridComplete: function () {
                $("#" + this.id).setSelection(selectedRowIndex, false);
            }
        });
    }


</script>
<div class="ui-layout" id="layout" style="height: 100%; width: 100%;">
    <div class="ui-layout-center">
        <div class="gridPanel">
            <table id="gridTable"></table>
            <div id="gridPager"></div>
        </div>
    </div>
</div>